from django.db import models

# Create your models here.

class Task(models.Model):
  title = models.CharField(max_length=200)
  completed = models.BooleanField(default=False, blank=True, null=True)
  
  def __str__(self):
    return self.title

# 基金交易数据
class FundTransactionRecord(models.Model):
  fund_id = models.CharField(max_length=100)
  date = models.CharField(max_length=200) # 净值日期
  average_nav = models.FloatField(default=0.0)
  accumulated_net = models.FloatField(default=0.0)
  daily_growth_rate = models.CharField(max_length=100)
  subscription_status = models.CharField(max_length=100)
  redemption_status = models.CharField(max_length=100)
  positions = models.FloatField(default=0.0)
  def __str__(self):
    return self.date

# 基金简介数据
class FundRecord(models.Model):
  fund_id = models.CharField(max_length=100, primary_key=True) # 基金代码
  fund_cn_name = models.CharField(max_length=200) # 基金中文名字
  pinyin_abbr = models.CharField(max_length=100) # 拼音缩写
  fund_type = models.CharField(max_length=100) # 基金类型
  pinyin_full = models.CharField(max_length=200) # 拼音全称
  def __str__(self):
    return self.fund_id

class StockTransactionRecordBak(models.Model):
  stock_id = models.CharField(max_length=100)
  day = models.CharField(max_length=256)
  open_price = models.CharField(max_length=256)
  high = models.CharField(max_length=256)
  low = models.CharField(max_length=256)
  close = models.CharField(max_length=256)
  volume = models.CharField(max_length=256)
  rate = models.FloatField(default=0.0)
  ma_price5 = models.FloatField(default=0.0)
  ma_volume5 = models.FloatField(default=0.0)
  def __str__(self):
    return self.stock_id
